﻿using Ejemplo.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Ejemplo.Controllers
{
    public class HomeController : Controller
    {
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Captcha()
        {
            ViewBag.Message = "A fresh CAPTCHA image is being displayed!";
            return View();
        }

        [HttpPost]
        public ActionResult Captcha(string CaptchaText)
        {
            if (CaptchaText == HttpContext.Session["captchastring"].ToString())
                ViewBag.Message = "CAPTCHA verification successful!";
            else
                ViewBag.Message = "CAPTCHA verification failed!";

            return View();
        }

        public CaptchaImageResult ShowCaptchaImage()
        {
            return new CaptchaImageResult();
        }
    }
}